/*
 * @(#)wordlist.h	1.6 06/10/10
 *
 * Copyright  1990-2008 Sun Microsystems, Inc. All Rights Reserved.  
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER  
 *   
 * This program is free software; you can redistribute it and/or  
 * modify it under the terms of the GNU General Public License version  
 * 2 only, as published by the Free Software Foundation.   
 *   
 * This program is distributed in the hope that it will be useful, but  
 * WITHOUT ANY WARRANTY; without even the implied warranty of  
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
 * General Public License version 2 for more details (a copy is  
 * included at /legal/license.txt).   
 *   
 * You should have received a copy of the GNU General Public License  
 * version 2 along with this work; if not, write to the Free Software  
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
 * 02110-1301 USA   
 *   
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa  
 * Clara, CA 95054 or visit www.sun.com if you need additional  
 * information or have any questions. 
 *
 */

#ifndef __WORDLISTH__
#define __WORDLISTH__
#include "POINTERLIST.h"
#include <stdio.h>

/*
 * This file declares the class
 * 	wordlist
 * and the functions
 *	new_wordlist
 *	print_wordlist
 * and	dispose_wordlist.
 *
 * A wordlist is a dopey little structure used
 * for passing around lists of names. They
 * accumulate in the parser and are turned into
 * ruletrees and disposed of in rule::make.
 * They used to be implemented as little linked-list
 * structures, but why not use POINTERLISTs?
 * I don't believe speed is an issue here.
 */

DERIVED_POINTERLIST_CLASS( wordlist, char *, word_iterator );

/*
 * allocate up the descriptor structure,
 * then add an element to it.
 */
wordlist * new_wordlist( const char * p );

/*
 * delete malloc'd part using standard destroy,
 * then deallocate descriptor structure as well
 */
void dispose_wordlist( wordlist *wp );

/*
 * traverse list, printing as we go.
 */
void	 print_wordlist( wordlist *wp, FILE * out = stdout );
#endif
